package za.co.chaotik.tron;

public class Position {
	private int x;
	private int y;
	private Entity value;
	
	public Position(int x, int y) {
		this.x = x;
		this.y = y;
		this.value = null;
	}
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	public Entity getValue() {
		return value;
	}
	
	public void setValue(Entity value) {
		this.value = value;
	}
	
	public float distance(Position pos) {
		float x = this.x - pos.x;
		float y = this.y - pos.y;
		
		// squares of x and y components
		x *= x;
		y *= y;
		
		// square-root of the sum of the components
		return (float) Math.sqrt(x + y);
	}
}
